%this function creates a global matrix averaging the contents of a
%composite array

%Ucomposite: composite array
%sizePool: number of labs in which the composite array is distributed

%Created by Ricardo Mejia-Alvarez. Urbana, IL. 07/02/09



function [Uglobal] = Composite2GlobalEnsemble(Ucomposite,sizePool)

for k = 1 : sizePool
    
    if k > 1
        Uglobal = Uglobal + Ucomposite{k};
    else
        Uglobal = Ucomposite{k};
    end
    
end

Uglobal = Uglobal / sizePool;

end